<?php
$db=new PDO('mysql:host=localhost','root','12qwas');
$db->exec("create database if not exists db3");
$db->exec("use db3");
$db->exec("create table if not exists students(xh varchar(9) primary key,name varchar(50), age int default 0)");
$r=$db->exec("delete from students where age>18");
echo "成功删除年龄大于18的{$r}记录~\n";
$r=$db->exec("truncate table students");
var_dump($r);
$r=$db->exec("insert into students(xh,name,age) values('233110101','张三',18),('233110102','张四',18),('233110103','张五',19)");
echo "成功插入了{$r}条数据~\n";
$r=$db->exec("update students set name='张三丰' where xh='233110104'");
echo "成功插入了{$r}条数据~\n";
//重新